﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BAL;
using Common;
using System.Text;
namespace Web
{
    public partial class PostCognitiveLevelShow : System.Web.UI.Page
    {
        private int parentid = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!UserValidate.CheckLogin(this.Request, "MasterQuesType"))
            {
                Response.Write("<script type=\"text/javascript\">top.location.href='login.aspx';</script>");
                Response.Redirect("login.aspx");
                Response.End();
            }
            if (Request.QueryString["parentid"] != null)
            {
                parentid = Convert.ToInt32(Request.QueryString["parentid"].Trim());
            }
            if (!IsPostBack)
            {
                if (parentid > 0)
                {
                    LoadCognitiveLevel();
                }
            }
        }
        protected void LoadCognitiveLevel()
        {
            IList<CognitiveLevelInfo> cognitiveLevelInfo = CognitiveLevel.GetList(parentid);
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul class='list2'>");
            foreach (CognitiveLevelInfo info in cognitiveLevelInfo)
            {
                sb.Append("<li>");
                sb.Append(info.Name);
                sb.Append("<span>[");
                sb.Append("<a href=\"javascript:ShowIframe('PostCognitiveLevelType.aspx?editid=" + info.Id + "','编辑认知层次',600,50);\">编辑</a> | ");
                sb.Append("<a href=\"javascript:ShowConfirm('PostCognitiveLevelType.aspx?delid=" + info.Id + "','删除认知层次将一并删除此级别已录入的所有试题，是否继续？',150,60)\">删除</a>");
                sb.Append("]</span>");
                sb.Append("</li>");
            }
            sb.Append("</ul>");
            CognitiveLevelList.Text = sb.ToString();
        }
    }
}
